package com.neusoft.bootthymeleaf.controller;


import com.neusoft.bootthymeleaf.domain.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.Arrays;
import java.util.List;

@Controller
public class StudentController {

    @GetMapping("/getList_stu.do")
    public ModelAndView GetStuList()
    {
        ModelAndView modelAndView = new ModelAndView();
        List<Student> list = getAll();
        modelAndView.setViewName("view/stu_list");
        modelAndView.addObject("stu_list",list);
        return modelAndView;
    }


    private List<Student> getAll()
    {
       return Arrays.asList(new Student[]{
                new Student(1,"掌声1","湖北武汉"),
                new Student(1,"掌声2","湖北武汉"),
                new Student(1,"掌声3","湖北武汉"),
                new Student(1,"掌声4","湖北武汉"),
                new Student(1,"掌声5","湖北武汉"),
                new Student(1,"掌声6","湖北武汉"),
        });
    }
}
